package com.jh.paymentchannel.repository;

import com.jh.paymentchannel.pojo.MiLianQuickBindCard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface MiLianQuickBindCardRepository extends JpaRepository<MiLianQuickBindCard, String>, JpaSpecificationExecutor<MiLianQuickBindCard> {
    @Query("select ml from  MiLianQuickBindCard ml where ml.userId=:userId and ml.bankCard=:bankCard")
    public MiLianQuickBindCard getMiLianQuickBindCardByUseridAndBankCard(@Param("userId") String userId, @Param("bankCard") String bankCard);

    @Modifying
    @Query("update MiLianQuickBindCard ml set ml.state='Y' where ml.userId=:userId and ml.bankCard=:bankCard")
    public Integer updateMiLianBindCardStateByIdAndBankId(@Param("userId") String userId, @Param("bankCard") String bankCard);

}
